Positions Book
retrieves the overnight and day positions as a list.
Request to be POSTed to uri : /NorenWClientAPI/PositionBook
Request Details :
| Parameter Name | Possible value | Description |
|---|---|---|
| jData* | Should send json object with fields in below list |
| Json Fields | Possible value | Description |
|---|---|---|
| uid* | Logged in User Id | |
| actid* | Account id of the logged in user. |
Example:
curl --location 'https://api.kambala.co.in/NorenWClientAPI/PositionBook' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer e5821f3f8b905f00ce2d4a1daa4fcc68cfeb4bf2f93a6263ca3db2a7ecac8e3a' \
--data 'jData={"uid":"DEMO","actid":"DEMO"}'
Response Details :
Response data will be in json format with Array of Objects with below fields in case of success.
| Json Fields | Possible value | Description |
|---|---|---|
| stat | Ok or Not_Ok | Position book success or failure indication. |
| uid | User Id | |
| actid | Account Id | |
| exch | Exchange segment | |
| tsym | Trading symbol / contract. | |
| s_prdt_ali | Product display name | |
| prd | Product name to be shown. | |
| token | Contract token | |
| symname | Symbol name | |
| instname | Instrument Name | |
| cname | Broker specific contract display name, present only if applicable. | |
| frzqty | Freez Quantity | |
| pp | Price precision | |
| ls | Lot size | |
| ti | Tick size | |
| mult | Contract price multiplier, (used for order value calculation) | |
| prcftr | gn*pn/(gd*pd). | |
| daybuyqty | Day Buy Quantity | |
| daysellqty | Day Sell Quantity | |
| daybuyamt | Day Buy Amount | |
| daybuyavgprc | Day Buy average price | |
| daysellamt | Day Sell Amount | |
| daysellavgprc | Day buy average price | |
| cfbuyqty | Carry Forward Buy Quantity | |
| cfsellqty | Carry Forward Sell Quantity | |
| cfbuyamt | Carry Forward Buy Amount | |
| cfbuyavgprc | Carry Forward Buy average price | |
| cfsellamt | Carry Forward Sell Amount | |
| cfsellavgprc | Carry Forward Buy average price | |
| cforgavgprc | Original Avg Price | |
| openbuyqty | Open Buy Quantity | |
| opensellqty | Open Sell Quantity | |
| openbuyamt | Open Buy Amount | |
| openbuyavgprc | Open Buy Average Price | |
| opensellamt | Open Sell Amount | |
| opensellavgprc | Open Sell Average Price | |
| dayavgprc | Day average price | |
| netqty | Net Position quantity | |
| netavgprc | Net position average price | |
| upldprc | Upload price | |
| netupldprc | Net Upload Price | |
| lp | LTP | |
| urmtom | UnrealizedMTOM.(Can be recalculated in LTP update (Can be recalculated in LTP update : = netqty * (lp from web socket - netavgprc) * prcftr | |
| bep | Break even price | |
| totbuyamt | Total buy amount | |
| totsellamt | Total sell amount | |
| instname | Instrument Name | |
| totbuyavgprc | Total buy average price | |
| totsellavgprc | Total sell avrage price | |
| rpnl | RealizedPNL |
NOTE: calculation of MTM and PnL
1.ActualUnrealizedMtoM= netqty(in weights) * prcftr * mult * (LTP - avgprc)
For MTM, avgprc = netavgprc;
For PnL, avgprc = netupldprc; if netupldprc = 0 then avgprc = netavgprc;
2.NetBuyQty = daybuyqty + cfbuyqty;
3.NetSellQty = daysellqty + cfsellqty;
4.ActualSellAvgPrice
if (NetSellQty != 0) {
ActualSellAvgPrice = ((daysellamt / mult) +(upldprc * prcftr * cfsellqty)) /NetSellQty;
} else
ActualSellAvgPrice = 0.0;
5.ActualBuyAvgPrice
if (NetBuyQty != 0) {
ActualBuyAvgPrice = ((daybuyamt / mult) +(upldprc * prcftr * cfbuyqty)) /NetBuyQty;
} else
ActualBuyAvgPrice = 0.0;
6.ActualBookedPNL
if (netqty(in weights) > 0) {
ActualBookedPNL = (ActualSellAvgPrice - ActualBuyAvgPrice) * NetSellQty * mult;
} else {
ActualBookedPNL = (ActualSellAvgPrice - ActualBuyAvgPrice) * NetBuyQty * mult;
}
7.MTM =rpnl + ActualUnrealizedMtoM
8.PnL=ActualBookedPNL + ActualUnrealizedMto
Response data will be in json format with below fields in case of failure:
| Json Fields | Possible value | Description |
|---|---|---|
| stat | Not_Ok | Position book request failure indication. |
| request_time | Response received time. | |
| emsg | Error message |
Sample Success Response :
[
{
"stat": "Ok",
"uid": "DEMO",
"actid": "DEMO",
"exch": "NSE",
"tsym": "SUZLON-EQ",
"s_prdt_ali": "CNC",
"prd": "C",
"token": "12018",
"symname": "SUZLON",
"instname": "EQ",
"cname": "SUZLON ENERGY LIMITED",
"frzqty": "1891775",
"pp": "2",
"ls": "1",
"ti": "0.01",
"mult": "1",
"prcftr": "1.000000",
"daybuyqty": "1",
"daysellqty": "0",
"daybuyamt": "53.35",
"daybuyavgprc": "53.35",
"daysellamt": "0.00",
"daysellavgprc": "0.00",
"cfbuyqty": "0",
"cfsellqty": "0",
"cfbuyamt": "0.00",
"cfbuyavgprc": "0.00",
"cfsellamt": "0.00",
"cfsellavgprc": "0.00",
"openbuyqty": "0",
"opensellqty": "0",
"openbuyamt": "0.00",
"openbuyavgprc": "0.00",
"opensellamt": "0.00",
"opensellavgprc": "0.00",
"dayavgprc": "53.35",
"netqty": "1",
"netavgprc": "53.35",
"upldprc": "0.00",
"netupldprc": "53.35",
"lp": "53.35",
"urmtom": "0.00",
"bep": "53.35",
"totbuyamt": "53.35",
"totsellamt": "0.00",
"totbuyavgprc": "53.35",
"totsellavgprc": "0.00",
"rpnl": "-0.00"
}
]
Sample Failure Response :
{
"stat":"Not_Ok",
"emsg":"Session Expired : Invalid Session Key"
}